{% extends 'search/base_facet.html' %}

{% load i18n %}

{% block faceting %}
{% if query %}
    <!-- Begin faceting. -->
    <h2>{% trans "By Author" %}</h2>

    <div class="filter">
        <dl>
            {% if facets.fields.author %}
                <dt>{% trans "Author" %}</dt>
                {# Provide only the top 5 authors #}
                {% for author in facets.fields.author|slice:":5" %}
                    {% if author.1 != 0 %}
                    <dd><a href="{{ request.get_full_path }}&amp;selected_facets=author:{{ author.0|urlencode }}">{{ author.0 }}</a> ({{ author.1 }})</dd>
                    {% endif %}
                {% endfor %}
            {% else %}
                <p>{% trans "No author facets." %}</p>
            {% endif %}
        </dl>
    </div>
    <!-- End faceting -->
{% endif %}
{% endblock %}

